package com.bw.zg3park2212.fangke

import androidx.lifecycle.MutableLiveData
import com.bw.base.entity.FangAddParam
import com.bw.base.entity.FangEntity
import com.bw.base.entity.FangEntityItem
import com.bw.base.mvvm.BaseViewModel
import com.bw.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel

import javax.inject.Inject

@HiltViewModel
class FangViewModel@Inject constructor(val apiServise: ApiService): BaseViewModel() {
    val fangSuccse= MutableLiveData<FangEntity>()
    fun getFang(){
        httpRequst(
            {apiServise.getFang()},
            fangSuccse::postValue
        )
    }
    val fangSuatasSuccse= MutableLiveData<FangEntity>()
    fun getFangSuatas(suatas:String){
        httpRequst(
            {apiServise.getFangZt(suatas)},
            fangSuatasSuccse::postValue
        )
    }
    val fangnameSuccse= MutableLiveData<FangEntity>()
    fun getname(name:String){
        httpRequst(
            {apiServise.getFangName(name)},
            fangnameSuccse::postValue
        )
    }
    val fangmudiSuccse= MutableLiveData<FangEntity>()
    fun getMudi(mudi:String){
        httpRequst(
            {apiServise.getFangMudi(mudi)},
            fangmudiSuccse::postValue
        )
    }
    val fangdelSuccse= MutableLiveData<Boolean>()
    fun getfangdel(id:Int){
        httpRequst(
            {apiServise.getFangDel(id)},
            fangdelSuccse::postValue
        )
    }
    val fangUpSuccse= MutableLiveData<FangEntityItem>()
    fun getfangUp(id:Int,fangAddParam: FangAddParam){
        httpRequst(
            {apiServise.getFangUp(id,fangAddParam)},
            fangUpSuccse::postValue
        )
    }
    val fangXiangSuccse=MutableLiveData<FangEntityItem>()
    fun getfangXiang(id:Int){
        httpRequst(
            {apiServise.getFangXiang(id)},
            fangXiangSuccse::postValue
        )
    }
    val fangAddSuccse=MutableLiveData<FangEntityItem>()
    fun getfangAdd(fangAddParam: FangAddParam){
        httpRequst(
            {apiServise.getFangAdd(fangAddParam)},
            fangAddSuccse::postValue
            )
    }
}